home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / BBalance.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  4.7 KB  |  163 lines

  1. /* Balancing objects example */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call init
  7. call CreateApp
  8. call handleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure expose global.
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.  
  15.     global.background.0="BACKGROUND"
  16.     global.background.1="SHADOW"
  17.     global.background.2="SHINE"
  18.     global.background.3="FILL"
  19.     global.background.4="SHADOWBACK"
  20.     global.background.5="SHADOWFILL"
  21.     global.background.6="SHADOWSHINE"
  22.     global.background.7="FILLBACK"
  23.     global.background.8="FILLSHINE"
  24.     global.background.9="SHINEBACK"
  25.     global.background.10="FILLBACK2"
  26.     global.background.11="HSHINEBACK"
  27.     global.background.12="HSHADOWBACK"
  28.     global.background.13="HSHINESHINE"
  29.     global.background.14="HSHADOWSHADOW"
  30.     global.background.14="MARKSHINE"
  31.     global.background.15="MARKHALFSHINE"
  32.     global.background.16="MARKBACKGROUND"
  33.  
  34.     global.idx=0
  35.  
  36.     call randu(time(s)) /* init seed */
  37.  
  38.     return
  39. /***********************************************************************/
  40. CreateApp: procedure expose global.
  41.  
  42.     app.Title="Balancing"
  43.     app.Version="$VER: BetterBalancing 1.2 (5.10.2001)"
  44.     app.Copyright="Copyright © 2001 by Alfonso Ranieri"
  45.     app.Author="Alfonso Ranieri"
  46.     app.Description="BetterBalancing example"
  47.     app.Base="BALANCING"
  48.     app.SubWindow="win"
  49.  
  50.      win.ID="MAIN"
  51.      win.Title="BetterBalancing"
  52.      win.width=-250
  53.      win.height=-250
  54.         g0.Frame="Group"
  55.         g0.Weight=15
  56.         g1.Frame="group"
  57.         g2.Frame="group"
  58.         g3.Frame="group"
  59.         g4.Frame="group"
  60.         g5.Frame="group"
  61.         g6.Frame="group"
  62.      win.Contents=MakeObj(,"HGroup",,
  63.        MakeObj("g0","VGroup",,
  64.         RectangleObject(50),,
  65.         RectangleObject(100),,
  66.         BetterBalanceObject(),,
  67.         RectangleObject(200)),,
  68.        BetterBalanceObject("Bal"),,
  69.        MakeObj("g1","VGroup",,
  70.         MakeObj(,"HGroup",,
  71.          RectangleObject(),,
  72.          BetterBalanceObject(),,
  73.          RectangleObject()),,
  74.         MakeObj(,"HGroup",,
  75.          RectangleObject(),,
  76.          BetterBalanceObject(),,
  77.          RectangleObject(),,
  78.          BetterBalanceObject(),,
  79.          RectangleObject(),,
  80.          BetterBalanceObject(),,
  81.          RectangleObject(),,
  82.          BetterBalanceObject(),,
  83.          RectangleObject()),,
  84.         MakeObj("g2","HGroup",,
  85.          MakeObj(,"HGroup",,
  86.            RectangleObject(),,
  87.            BetterBalanceObject(),,
  88.            RectangleObject()),,
  89.          BetterBalanceObject(),,
  90.          MakeObj(,"HGroup",,
  91.           RectangleObject(),,
  92.           BetterBalanceObject(),,
  93.           RectangleObject())),,
  94.         MakeObj("g3","HGroup",,
  95.          RectangleObject(50),,
  96.          RectangleObject(100),,
  97.          BetterBalanceObject(),,
  98.          RectangleObject(200)),,
  99.         MakeObj("g4","HGroup",,
  100.          button("also","Also"),,
  101.          BetterBalanceObject(),,
  102.          button("try","Try"),,
  103.          BetterBalanceObject(),,
  104.          button("sizing","Sizing"),,
  105.          BetterBalanceObject(),,
  106.          button("with","With"),,
  107.          BetterBalanceObject(),,
  108.          button("shift","Shift")),,
  109.         MakeObj("g5","HGroup",,
  110.          label("Label 1:"),,
  111.          text("data","data..."),,
  112.          BetterBalanceObject(),,
  113.          label("Label 2:"),,
  114.          text("more","more data..."))))
  115.  
  116.     if NewObj("APPLICATION","APP")>0 then exit
  117.  
  118.     call DoMethod("app","Load","Env")
  119.  
  120.     call Notify("WIN","CLOSEREQUEST",1,"APP","RETURNID","QUIT")
  121.  
  122.     call set("win","defaultobject","Bal")
  123.     call set("win","open",1)
  124.  
  125.     return
  126. /**************************************************************************/
  127. HandleApp: procedure
  128.     do forever
  129.         call newhandle("APP","H",2**12)
  130.         if and(h.signals,2**12)>0 then exit
  131.         select
  132.             when h.event="QUIT" then do
  133.                 call DoMethod("App","Save","Env")
  134.                 exit
  135.             end
  136.             otherwise nop
  137.         end
  138.     end
  139.     /* never reached */
  140. /***********************************************************************/
  141. halt:
  142. break_c:
  143.     exit
  144. /**************************************************************************/
  145. RectangleObject: procedure expose global.
  146. parse arg w,f
  147.  
  148.     if arg(1,'e') then rec.Weight=w
  149.     if arg(2,'e') then rec.Frame=f
  150.     else rec.Frame="Text"
  151.  
  152.     i=random(0,17)
  153.     rec.Background=global.Background.i
  154.  
  155.     return XNewObj("Rectangle",,"rec")
  156. /**************************************************************************/
  157. BetterBalanceObject: procedure expose global.
  158. parse arg n
  159.     o=MakeObj(n,"BetterBalance",global.idx)
  160.     global.idx=global.idx+1
  161.     return o
  162. /**************************************************************************/
  163.